Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new validation to validate URL formatted attributes #1065

Merged
merged 1 commit into from
Sep 28, 2024

Conversation

jwoertink
Copy link
Member

Fixes #667

Adds new validate_url_format validator.

@jwoertink jwoertink merged commit 6922463 into main Sep 28, 2024
9 checks passed
@jwoertink jwoertink deleted the issues/667 branch September 28, 2024 20:40
if url = attribute.value.presence
uri = URI.parse(url)
if uri.scheme != scheme || uri.host.presence.nil?
attribute.add_error(message % scheme)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow this is slick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add validator for URLs
2 participants